From 18536c4400440bc09c0e385a1aefff1458b487cc Mon Sep 17 00:00:00 2001 From: Ralf Horstmann Date: Wed, 15 Feb 2017 20:02:02 +0100 Subject: [PATCH] Fix GeoGrid OVL V2.0 Unknown subtype (17) Fixes issue #66. OVL V2.0 files contain the additional text field for all subtype values != 1, not just for subtype 0x10. The V3.0 and V4.0 readers do handle this correctly already. Add a test case that exposes the bug. Change bincompare to compare for the gpx output files in the ggv_bin test cases while there. --- ggv_bin.cc | 10 +--------- reference/ggv_bin-sample-v2.gpx | 25 +++++++++++++++++++++++++ reference/ggv_bin-sample-v2.ovl | Bin 0 -> 2593 bytes testo.d/ggv_bin.test | 4 +++- 4 files changed, 29 insertions(+), 10 deletions(-) create mode 100644 reference/ggv_bin-sample-v2.gpx create mode 100644 reference/ggv_bin-sample-v2.ovl diff --git a/ggv_bin.cc b/ggv_bin.cc index 9a616cfe5..6c87e2dc3 100644 --- a/ggv_bin.cc +++ b/ggv_bin.cc @@ -143,17 +143,9 @@ ggv_bin_read_v2(QDataStream& stream) ggv_bin_read16(stream, "entry zoom"); entry_subtype = ggv_bin_read16(stream, "entry subtype"); - switch (entry_subtype) { - case 0x01: - // no data following - break; - case 0x10: - // text with 32 bit length field follows + if (entry_subtype != 1) { ggv_bin_read_text32(stream, buf, "text len"); track_name = QString::fromLatin1(buf.constData()).simplified(); - break; - default: - fatal(MYNAME ": Unknown subtype (%hu)\n", entry_subtype); } switch (entry_type) { diff --git a/reference/ggv_bin-sample-v2.gpx b/reference/ggv_bin-sample-v2.gpx new file mode 100644 index 000000000..887b03eec --- /dev/null +++ b/reference/ggv_bin-sample-v2.gpx @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/reference/ggv_bin-sample-v2.ovl b/reference/ggv_bin-sample-v2.ovl new file mode 100644 index 0000000000000000000000000000000000000000..04f98fe406435d08a698654c05f6410d9f7502f7 GIT binary patch literal 2593 zcmZ?q_jM0*4sucOFUv{G%t=)UGtx7#Vwk|d#K6c9l3$>w;GI}hlB!^6Won>jU|^u& zlvtTsl&2f~Cxw9lh`_j7^_9A#vzmj=hXj##${r5+Ld^$GIjT9NCLZbCtM1|OAE?fX zfemOPE0D#&aEs+R6PQ5)!3xyP$RNnT!@|H2mReMtnV+X%tY<)i3ByOJt5uATzq4bA zr@voJh<^YuW?URYhL86~eL`di_&a&II)}vjcm|Km*k54704x)@fRF)LUNJGCmph|n z1|lJimKlh!7|E=WUS_m$pq3doPKH)n0oyKCx7Ka}wOv@i?F>*`gNcEIL4cvpN6_Mq zgPOyEYpT=cDS0@|$ZvXj5ZJbv{LxBy4v_z+__JV(lbVCbf1W}RpX1DlE+wFOv+r+O zxCqGqU=`knf;AMOz%GeqY3!>=QtK56|twG@yBt^!hnY1NkfEp8w_n z^3(XQb>0E;Pns3aodC37=Id9{7eM~ePgU#h+p9SoY4cn17NnjrIdLzLFBGJH^B$1@ zPSa-XY#?84|6lXtKz^L|u}PIceoEHms;xl&5-&vyHz5DmYQc+hfqWlL$A26^^Q-=* LM@|Lu(ftbm6ST6Y literal 0 HcmV?d00001 diff --git a/testo.d/ggv_bin.test b/testo.d/ggv_bin.test index 9351091c4..2f672477a 100644 --- a/testo.d/ggv_bin.test +++ b/testo.d/ggv_bin.test @@ -2,5 +2,7 @@ # Geogrid-Viewer binary overlay files # rm -f ${TMPDIR}/ggv_bin* +gpsbabel -i ggv_bin -f ${REFERENCE}/ggv_bin-sample-v2.ovl -o gpx -F ${TMPDIR}/ggv_bin-sample-v2.gpx +compare ${REFERENCE}/ggv_bin-sample-v2.gpx ${TMPDIR}/ggv_bin-sample-v2.gpx gpsbabel -i ggv_bin -f ${REFERENCE}/ggv_bin-sample-v3.ovl -o gpx -F ${TMPDIR}/ggv_bin-sample-v3.gpx -bincompare ${REFERENCE}/ggv_bin-sample-v3.gpx ${TMPDIR}/ggv_bin-sample-v3.gpx +compare ${REFERENCE}/ggv_bin-sample-v3.gpx ${TMPDIR}/ggv_bin-sample-v3.gpx -- 2.30.2